<%@ page language="java" contentType="text/html; charset=utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<title>茶商后台管理</title>
<link rel="stylesheet" href="layui-v2.4.3/layui/css/layui.css"
	media="all">
</head>
<script src="layui-v2.4.3/layui/layui.js"></script>
<script type="text/javascript">
	function check() {
		if (confirm("确认删除吗？")) {
			alert("删除成功！！");
			location.href = "back_index.jsp"
			//跳转到servlet页面进行数据的更新
		} else {
			alert("删除失败！！");
			out.print("error.html");
		}
	}
</script>
<body class="layui-layout-body">
<%
	request.setCharacterEncoding("utf-8");
%>
	<div class="layui-layout layui-layout-admin">
		<div class="layui-header">
			<div class="layui-logo">醉品茶城</div>
			<!-- 头部区域（可配合layui已有的水平导航） -->
			<ul class="layui-nav layui-layout-left">
				<li class="layui-nav-item"><a href="ShowUser.jsp">用户信息</a></li>
				<li class="layui-nav-item"><a href="ShowGoods.jsp">商品信息</a></li>
				<li class="layui-nav-item"><a href="ShowOrder.jsp">订单信息</a></li>
				<li class="layui-nav-item"><a href="javascript:;">其它系统</a>
					<dl class="layui-nav-child">
						<dd>
							<a href="">邮件管理</a>
						</dd>
						<dd>
							<a href="">消息管理</a>
						</dd>
						<dd>
							<a href="">授权管理</a>
						</dd>
					</dl></li>
			</ul>

			<ul class="layui-nav layui-layout-right">
				<li class="layui-nav-item"><a href="javascript:;"> <img
						src="http://t.cn/RCzsdCq" class="layui-nav-img"> 用户名
				</a></li>
				<li class="layui-nav-item"><a href="">退出</a></li>
			</ul>
		</div>

		<div class="layui-side layui-bg-black">
			<div class="layui-side-scroll">
				<!-- 左侧导航区域（可配合layui已有的垂直导航） -->
				<ul class="layui-nav layui-nav-tree" lay-filter="test">
					<li class="layui-nav-item layui-nav-itemed"><a class=""
						href="javascript:;">用户管理</a>
						<dl class="layui-nav-child">
							<dd>
								<a href="userUpdate.jsp">用户修改</a>
							</dd>
							<dd>
								<a href="userDel.jsp">用户删除</a>
							</dd>
						</dl></li>
					<li class="layui-nav-item"><a href="javascript:;">订单管理</a>
						<dl class="layui-nav-child">
							<dd>
								<a href="OrderUpdate.jsp">订单修改</a>
							</dd>
							<dd>
								<a href="OrderDel.jsp">订单删除</a>
							</dd>
						</dl></li>
					<li class="layui-nav-item"><a href="javascript:;">商品管理</a>
						<dl class="layui-nav-child">
							<dd>
								<a href=""<%=request.getContextPath()%>/TypeServlet"">商品增加</a>
							</dd>
							<dd><a href="GoodsDel.jsp">商品操作</a></dd>
						</dl></li>
					<li class="layui-nav-item"><a href="javascript:;">新闻管理</a>
						<dl class="layui-nav-child">
							<dd>
								<a href="NewsInsert.jsp">新闻增加</a>
							</dd>
							<dd><a href="NewsUpdateAndDelete.jsp">新闻操作</a></dd>  
						</dl></li>
					 <li class="layui-nav-item">
        <a href="javascript:;">反馈信息</a>
         <dl class="layui-nav-child">
            <dd><a href="FeedbackShowAndDelete.jsp">反馈查看和删除</a></dd>          
          </dl>
        </li>
				</ul>
			</div>
		</div>
		<div class="layui-body">
			<!-- 内容主体区域 -->
			<div style="padding: 15px;">
				
				<table class="layui-hide" id="test" lay-filter="test"></table>
			</div>
		</div>
		<!-- 底部区域 -->
		<div class="layui-footer" style="text-align: center">©
			chachegn.com - 醉品商城</div>
	</div>
<script type="text/html" id="barDemo">
  <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
  <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>

</script>
            
	<script>
		//JavaScript代码区域：左侧的下拉列表
		layui.use('element', function() {
			var element = layui.element;
		});
		
		layui.use('table', function(){
			  var table = layui.table;
			  table.render({
			    elem: '#test'
			    ,url:'../NewsServlet?opt=showAll'
			    ,toolbar: '#toolbarDemo'
			    ,title: '用户数据表'
			    ,cols: [[
			      {field:'nid', title:'ID', width:80}
			      ,{field:'author', title:'作者', width:100}
			      ,{field:'title', title:'标题', width:200}
			      ,{field:'page1', title:'内容',width:500}
			      ,{fixed: 'right', title:'操作', toolbar: '#barDemo', width:150}
			    ]]
			    ,page: true
			  });
			  //监听行工具事件
			  table.on('tool(test)', function(obj){
			    var data = obj.data;
			    if(obj.event === 'del'){
			      layer.confirm('真的删除行么',{icon:3,title:'系统提示',btn:['确定','取消']}, function(index){
			    	  var count = data.nid;
				       location.href='../NewsServlet?opt=delete&nid='+count;
			        layer.close(index);
			      });
			    }else if(obj.event === 'edit'){
			    	layer.confirm('确定修改吗',{icon:3,title:'系统提示',btn:['确定','取消']}, function(index){
			    	       var count = data.nid;
			    	       location.href='../NewsServlet?opt=sel2&nid='+count;
			    	        layer.close(index);
			      });
			    }
			  });
			});
	</script>
</body>
</html>